package cn.redragon.soa.data.entity;

import com.fasterxml.jackson.databind.JsonNode;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import lombok.AccessLevel;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.experimental.SuperBuilder;
import org.hibernate.annotations.Type;

@Data
@Entity
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor(access = AccessLevel.PRIVATE)
@Table(name = "system_log")
public class SystemLogEntity extends BaseEntity {

    private static final long serialVersionUID = 1909105764840654380L;

    private String module;

    private String url;

    @Column(name = "action_type", length = 32, nullable = false)
    private String actionType;

    private String description;
    
    private String traceId;

    @Type(type = "json")
    @Column(name = "request_header", columnDefinition = "json")
    private JsonNode requestHeader;

    @Type(type = "json")
    @Column(name = "request_payload", columnDefinition = "json")
    private JsonNode requestPayload;

    @Type(type = "json")
    @Column(name = "response", columnDefinition = "json")
    private JsonNode response;
}
